<?php 
      echo $this->Html->css("chosen");
      echo $this->Html->css("dataTables");
      echo $this->Html->css("validationEngine.jquery");
 ?>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/customInput.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/chosen.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/zice.custom1.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/ColVis.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/layout_table.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/manager_employee.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.autotab.js"></script>

<div class="titlePage">
<h1>Quản lý nhân viên</h1>
</div>
<div class="onecolumn">
	<div class="header">
		<span><span class="ico gray group"></span>Nhân viên</span>
	</div>
	<div class=" clear"></div>
	<div class="content">
	 <div id="uploadTab">
                      <ul class="tabs" >
                          <li ><a href="#tab1"   >   Nhân viên  </a></li>  
                          <li ><a href="#tab2"   >   Người dùng  </a></li>            
                      </ul>
                      <div class="tab_container" >
                      <div id="tab1" class="tab_content"> 
                            <div class="load_page">
				             	<form id="validation">
											<div class="tableName toolbar">
												<table class="display data_table2 listEmployee" >
													<thead>
														<tr>
															<th><div class="th_wrapp">Tên nhân viên</div></th>
															<th><div class="th_wrapp">Điên thoại</div></th>
															<th><div class="th_wrapp">Loại nhân viên</div></th>
															<th><div class="th_wrapp">Ngày vào làm</div></th>
															<th><div class="th_wrapp">Người dùng</div></th>
															<th><div class="th_wrapp">Quản lý</div></th>
														</tr>
													</thead>
													<tbody>
													<?php 
								foreach ($employee as $item) {
							?>
									<tr class="odd gradeX editWh" id="<?php echo $item['e']['id'].'_edit'?>">
				      					<td class='editName'><div class='old_name'><?php  echo $item['e']['name'];?></div>
				      						<input id="<?php echo $item['e']['id'].'_edit_n'?>" value ="<?php echo $item['e']['name'];?>" class='validate[required] tmp_name' style="display: none"/>
				      					</td>
				      					<td class='editPhone'><div class='old_phone'><?php  echo $item['e']['phone'];?></div>
				      						<input id="<?php echo $item['e']['id'].'_edit_p'?>" value ="<?php echo $item['e']['phone'];?>" class='validate[required,custom[phone] tmp_phone' style="display: none"/>
				      					</td>
				      					<td class='editType'><div class='old_type'><?php  echo $item['et']['name'];?></div>
				      						<input id="<?php echo $item['e']['id'].'_edit_t'?>" value ="<?php echo $item['et']['name'];?>" class='validate[required] tmp_type' style="display: none"/>
				      					</td>
				      					<td><?php echo $item['e']['start'] ?></td>
				      					<td class='editUser'><div class='old_user'><?php  echo $item['u']['username'];?></div>
				      						<input id="<?php echo $item['e']['id'].'_edit_u'?>" value ="<?php echo $item['u']['username'];?>" class='validate[required] tmp_user' style="display: none"/>
				      					</td>
					      					<td >
				                                <span class='btnEditE'>
				                                      <a  title="Edit" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/pencil.png" >
				                                      </a>
				                                 </span> 
				                                 <span class="tip btnDeleteE" >
				                                       <a title="Delete"  >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/delete.png" >
				                                       </a>
				                                </span> 
				                                <span class='btnSaveE' style="display: none">
				                                      <a  title="Save" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/checkmark2.png" >
				                                      </a>
				                                 </span>
				                                 <span class='btnCancelE' style="display: none">
				                                      <a  title="Cancel" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/cross.png" >
									                                      </a>
									                                 </span>
									                            </td>
				      										</tr><?php }?>
									</tbody>
								
								</table>
				            </div>
						</form>
						<form id="validation">
							<a class="uibutton icon add addNewEmployee">Thêm mới</a>
							<a class="uibutton icon attendanceDriver">Chấm công tài xế, lơ xe</a>
							<a class="uibutton icon attendanceEmployee">Chấm công nhân viên</a>
							<div class="newEmployee">
								<h4>Nhân viên mới</h4>
								<div class="section">
									<label>
									Tên nhân viên:
									
									</label>
									<div>
										<input class="validate[required] large" type="text" id="employee_name">
										
									</div>
								</div>
								<div class="section numericonly">
									<label>
									Số điện thoại:
									
									</label>
									<div>
										<input class="validate[required,custom[phone]] large" type="text" id="employee_phone">
										
									</div>
								</div>
								<div class="section">
									<label>
									Ngày vào làm:
									
									</label>
									<div>
										<input type="text"  id="dateStart" class="dateStart validate[required]" name="dateStart"  />										
									</div>
								</div>
								<div class="section">
									<label>
									Loại nhân viên:
									</label>
									<div id="search_type">
										<select data-placeholder="Chọn loại..." class="chzn-select choose_type" tabindex="2" id='employee_type'>
                                                                                        <option value=""></option> 
                                                                                        <?php foreach ($employee_types as $item) {?>
                                                                                            <option value="<?php echo $item['et']['id']; ?>"><?php echo $item['et']['name'];}?></option>
                                                                               </select>
									</div>
								</div>
                                                                <div class="section">
									<label>
									Người dùng:
									</label>
									<div id="search_user">
										<select data-placeholder="Chọn người dùng..." class="chzn-select choose_user" tabindex="2" id='employee_user'>
                                                                                        <option value=""></option> 
                                                                                        <?php foreach ($employee_user as $item) {?>
                                                                                            <option value="<?php echo $item['u']['id']; ?>"><?php echo $item['u']['username'];}?></option>
                                                                               </select>
									</div>
								</div>
								<div class="buttonNewEmployee">
									<a class="uibutton add_employee"><span class="ico gray checkmark2"></span>Lưu</a>
									<a class="uibutton special cancel"><span class="ico gray cross"></span>Hủy</a>
								</div>
							</div>
						</form>
						</div>
	            </div>
	            <div id="tab2" class="tab_content"> 
                            <div class="load_page">
				             	<form id="validation">
											<div class="tableName toolbar">
												<table class="display data_table2 listUser" >
													<thead>
														<tr>
															<th><div class="th_wrapp">Tên người dùng</div></th>
															<th><div class="th_wrapp">Mật khẩu</div></th>
															<th><div class="th_wrapp">Email</div></th>
															<th><div class="th_wrapp">Cấp bậc</div></th>
															<th><div class="th_wrapp">Quản lý</div></th>
														</tr>
													</thead>
													<tbody>
													<?php 
								foreach ($user as $item) {
							?>
									<tr class="odd gradeX editUs" id="<?php echo $item['u']['id'].'_edit'?>">
				      					<td class='editName'><div class='old_name'><?php  echo $item['u']['username'];?></div>
				      						<input id="<?php echo $item['u']['id'].'_edit_n'?>" value ="<?php echo $item['u']['username'];?>" class='validate[required] tmp_name' style="display: none"/>
				      					</td>
				      					<td class='editPass'><div class='old_pass'><?php  echo $item['u']['password'];?></div>
				      						<input id="<?php echo $item['u']['id'].'_edit_p'?>" value ="<?php echo $item['u']['password'];?>" class='validate[required] tmp_pass' style="display: none"/>
				      					</td>
				      					<td class='editEmail'><div class='old_email'><?php  echo $item['u']['email'];?></div>
				      						<input id="<?php echo $item['u']['id'].'_edit_e'?>" value ="<?php echo $item['u']['email'];?>" class='validate[required] tmp_mail' style="display: none"/>
				      					</td>
				      					<td class='editLevel'><div class='old_level'><?php  echo $item['u']['user_type'];?></div>
				      						<input id="<?php echo $item['u']['id'].'_edit_l'?>" value ="<?php echo $item['u']['user_type'];?>" class='validate[required] tmp_level' style="display: none"/>
				      					</td>	
					      					<td >
				                                <span class='btnEditU'>
				                                      <a  title="Edit" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/pencil.png" >
				                                      </a>
				                                 </span> 
				                                 <span class="tip btnDeleteU" >
				                                       <a title="Delete"  >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/delete.png" >
				                                       </a>
				                                </span> 
				                                <span class='btnSaveU' style="display: none">
				                                      <a  title="Save" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/checkmark2.png" >
				                                      </a>
				                                 </span>
				                                 <span class='btnCancelU' style="display: none">
				                                      <a  title="Cancel" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/cross.png" >
									                                      </a>
									                                 </span>
									                            </td>
				      										</tr><?php }?>
									</tbody>
								
								</table>
				            </div>
						</form>
						<form id="validation">
							<a class="uibutton icon add addNewUser">Thêm mới</a>
							<div class="newUser">
								<h4>Người dùng mới</h4>
								<div class="section">
									<label>
									Tên người dùng:
									
									</label>
									<div>
										<input class="validate[required] large" type="text" id="user_name">
										
									</div>
								</div>
								<div class="section">
									<label>
									Mật khẩu:
									
									</label>
									<div>
										<input type="password" name="password" class="validate[required] large" type="text" id="user_pass">
										
									</div>
								</div>
								<div class="section">
									<label>
									Nhập lại mật khẩu:
									
									</label>
									<div>
										<input type="password" name="password1" class="validate[required,equals[user_pass]] large" type="text" id="user_pass1">
										
									</div>
								</div>
								<div class="section">
									<label>
									Email:
									
									</label>
									<div>
										<input class="validate[required,custom[email]] large" type="text" id="user_email">
										
									</div>
								</div>
								<div class="section">
									<label>
									Cấp bậc:
									
									</label>
									<div>
										<input class="validate[required] large" type="text" id="user_level">
										
									</div>
								</div>				
								<div class="buttonNewUser">
									<a class="uibutton add_user"><span class="ico gray checkmark2"></span>Lưu</a>
									<a class="uibutton special cancel"><span class="ico gray cross"></span>Hủy</a>
								</div>
							</div>
						</form>
						</div>
	            </div>
		</div>
		</div>
		<div class="clear"/></div>  
	</div>
</div>